package com.test.elasticsearch.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author JunHao Deng
 * @Title: 
 * @date 2021/03/25 10:49
 * @description：esconfig 配置elasticsearch，es7之后推荐使用java rest client ，high/low 决定是否自己处理编排反编排（对请求参数封装/响应结果的解析）
 * es本地：localhost：9200/127.0.0.1:9200
 **/
@Configuration
public class ElasticSearchClientConfig {
    @Bean
    public RestHighLevelClient restHighLevelClient(){
        RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(
                new HttpHost("127.0.0.1",9200,"http")));
        return client;
    }
}
